3.46 \(\int \csc (e+f x) (a+b \tan ^2(e+f x))^2 \, dx\)

Optimal. Leaf size=52 \[ -\frac {a^2 \tanh ^{-1}(\cos (e+f x))}{f}+\frac {b (2 a-b) \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \]

[Out]

-a^2*arctanh(cos(f*x+e))/f+(2*a-b)*b*sec(f*x+e)/f+1/3*b^2*sec(f*x+e)^3/f

________________________________________________________________________________________

Rubi [A]  time = 0.05, antiderivative size = 52, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3664, 390, 207} \[ -\frac {a^2 \tanh ^{-1}(\cos (e+f x))}{f}+\frac {b (2 a-b) \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f} \]

Antiderivative was successfully verified.

[In]

Int[Csc[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

-((a^2*ArcTanh[Cos[e + f*x]])/f) + ((2*a - b)*b*Sec[e + f*x])/f + (b^2*Sec[e + f*x]^3)/(3*f)

Rule 207

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTanh[(Rt[b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 390

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_))^(q_), x_Symbol] :> Int[PolynomialDivide[(a + b*x^n)
^p, (c + d*x^n)^(-q), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[n, 0] && IGtQ[p, 0] && ILt
Q[q, 0] && GeQ[p, -q]

Rule 3664

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Sec[e + f*x], x]}, Dist[1/(f*ff^m), Subst[Int[((-1 + ff^2*x^2)^((m - 1)/2)*(a - b + b*ff^2*x^2)^p)/x^(
m + 1), x], x, Sec[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rubi steps

\begin {align*} \int \csc (e+f x) \left (a+b \tan ^2(e+f x)\right )^2 \, dx &=\frac {\operatorname {Subst}\left (\int \frac {\left (a-b+b x^2\right )^2}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=\frac {\operatorname {Subst}\left (\int \left ((2 a-b) b+b^2 x^2+\frac {a^2}{-1+x^2}\right ) \, dx,x,\sec (e+f x)\right )}{f}\\ &=\frac {(2 a-b) b \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f}+\frac {a^2 \operatorname {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\sec (e+f x)\right )}{f}\\ &=-\frac {a^2 \tanh ^{-1}(\cos (e+f x))}{f}+\frac {(2 a-b) b \sec (e+f x)}{f}+\frac {b^2 \sec ^3(e+f x)}{3 f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.17, size = 66, normalized size = 1.27 \[ \frac {3 a^2 \left (\log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )\right )+3 b (2 a-b) \sec (e+f x)+b^2 \sec ^3(e+f x)}{3 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Csc[e + f*x]*(a + b*Tan[e + f*x]^2)^2,x]

[Out]

(3*a^2*(-Log[Cos[(e + f*x)/2]] + Log[Sin[(e + f*x)/2]]) + 3*(2*a - b)*b*Sec[e + f*x] + b^2*Sec[e + f*x]^3)/(3*
f)

________________________________________________________________________________________

fricas [A]  time = 0.56, size = 87, normalized size = 1.67 \[ -\frac {3 \, a^{2} \cos \left (f x + e\right )^{3} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) - 3 \, a^{2} \cos \left (f x + e\right )^{3} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) - 6 \, {\left (2 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, b^{2}}{6 \, f \cos \left (f x + e\right )^{3}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="fricas")

[Out]

-1/6*(3*a^2*cos(f*x + e)^3*log(1/2*cos(f*x + e) + 1/2) - 3*a^2*cos(f*x + e)^3*log(-1/2*cos(f*x + e) + 1/2) - 6
*(2*a*b - b^2)*cos(f*x + e)^2 - 2*b^2)/(f*cos(f*x + e)^3)

________________________________________________________________________________________

giac [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotImplementedError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="giac")

[Out]

Exception raised: NotImplementedError >> Unable to parse Giac output: Unable to check sign: (2*pi/x/2)>(-2*pi/
x/2)Unable to check sign: (2*pi/x/2)>(-2*pi/x/2)2/f*((-6*((1-cos(f*x+exp(1)))/(1+cos(f*x+exp(1))))^2*a*b+12*(1
-cos(f*x+exp(1)))/(1+cos(f*x+exp(1)))*a*b-6*(1-cos(f*x+exp(1)))/(1+cos(f*x+exp(1)))*b^2-6*a*b+2*b^2)*1/3/((1-c
os(f*x+exp(1)))/(1+cos(f*x+exp(1)))-1)^3+a^2/4*ln(abs(1-cos(f*x+exp(1)))/abs(1+cos(f*x+exp(1)))))

________________________________________________________________________________________

maple [B]  time = 0.55, size = 124, normalized size = 2.38 \[ \frac {a^{2} \ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{f}+\frac {2 a b}{f \cos \left (f x +e \right )}+\frac {b^{2} \left (\sin ^{4}\left (f x +e \right )\right )}{3 f \cos \left (f x +e \right )^{3}}-\frac {b^{2} \left (\sin ^{4}\left (f x +e \right )\right )}{3 f \cos \left (f x +e \right )}-\frac {b^{2} \left (\sin ^{2}\left (f x +e \right )\right ) \cos \left (f x +e \right )}{3 f}-\frac {2 \cos \left (f x +e \right ) b^{2}}{3 f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(csc(f*x+e)*(a+b*tan(f*x+e)^2)^2,x)

[Out]

1/f*a^2*ln(csc(f*x+e)-cot(f*x+e))+2/f*a*b/cos(f*x+e)+1/3/f*b^2*sin(f*x+e)^4/cos(f*x+e)^3-1/3/f*b^2*sin(f*x+e)^
4/cos(f*x+e)-1/3/f*b^2*sin(f*x+e)^2*cos(f*x+e)-2/3/f*cos(f*x+e)*b^2

________________________________________________________________________________________

maxima [A]  time = 0.31, size = 68, normalized size = 1.31 \[ -\frac {3 \, a^{2} \log \left (\cos \left (f x + e\right ) + 1\right ) - 3 \, a^{2} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac {2 \, {\left (3 \, {\left (2 \, a b - b^{2}\right )} \cos \left (f x + e\right )^{2} + b^{2}\right )}}{\cos \left (f x + e\right )^{3}}}{6 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*tan(f*x+e)^2)^2,x, algorithm="maxima")

[Out]

-1/6*(3*a^2*log(cos(f*x + e) + 1) - 3*a^2*log(cos(f*x + e) - 1) - 2*(3*(2*a*b - b^2)*cos(f*x + e)^2 + b^2)/cos
(f*x + e)^3)/f

________________________________________________________________________________________

mupad [B]  time = 12.64, size = 86, normalized size = 1.65 \[ \frac {a^2\,\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )}{f}-\frac {4\,a\,b-{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (8\,a\,b-4\,b^2\right )-\frac {4\,b^2}{3}+4\,a\,b\,{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^4}{f\,{\left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2-1\right )}^3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tan(e + f*x)^2)^2/sin(e + f*x),x)

[Out]

(a^2*log(tan(e/2 + (f*x)/2)))/f - (4*a*b - tan(e/2 + (f*x)/2)^2*(8*a*b - 4*b^2) - (4*b^2)/3 + 4*a*b*tan(e/2 +
(f*x)/2)^4)/(f*(tan(e/2 + (f*x)/2)^2 - 1)^3)

________________________________________________________________________________________

sympy [F]  time = 0.00, size = 0, normalized size = 0.00 \[ \int \left (a + b \tan ^{2}{\left (e + f x \right )}\right )^{2} \csc {\left (e + f x \right )}\, dx \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(csc(f*x+e)*(a+b*tan(f*x+e)**2)**2,x)

[Out]

Integral((a + b*tan(e + f*x)**2)**2*csc(e + f*x), x)

________________________________________________________________________________________